Imports System.Collections
Imports SchemaCodeGen

Partial Class pages_templatesets_usercontrols_UCTemplateSet : Inherits UserControl

#Region "Members"
    Private m_templateSet As CTemplateSet
    Private m_sortedList As IList
#End Region

#Region "Interface"
    Public Sub Display(ByVal [templateSet] As CTemplateSet, sortedList as IList)
        If Parent.Controls.Count Mod 2 = 0 Then row.Attributes.Add("class", "alt_row")

        m_templateSet = [templateSet]
        m_sortedList = sortedList

        With m_templateSet
            litNumber.Text = CStr(sortedList.IndexOf(m_templateSet) + 1)
			litSetLanguageId.Text = .Language.LanguageName
			litSetParentSetId.Text = .ParentName
			If IsNothing(.SetName) Then
				lnkSetName.Text = "*Default"
			Else
				lnkSetName.Text = .SetName_
			End If
			lnkSetName.NavigateUrl = CSitemap.TemplateSetEdit(.SetId)
			litSetUserName.Text = .SetUserName
			litConnections.Text = .ConnectionsCount.ToString("n0")
			litFiles.Text = .ContentsCount.ToString("n0")
			litSetCreated.Text = CUtilities.Timespan(.SetCreated)
			litSetCreated.ToolTip = CUtilities.LongDateTime(.SetCreated)
		End With
    End Sub
#End Region

#Region "Event Handlers"
    Private Sub btnDelete_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnDelete.Click
        m_templateSet.Delete()
        Refresh()
    End Sub
#End Region

#Region "Private"
    Private Sub Refresh()
        'CCache.ClearCache()

        'If False Then 'Request.RawUrl.ToLower.Contains("myparent.aspx") Then
        '    'Special case: Parent entity owns the list
        '    Response.Redirect(CSitemap.MyParentEdit(m_templateSet.TemplateSetParentId, MyParent.ETab.templatesets, m_pageIndex)
        'Else
        '    'Normal case: Search page owns the list
            Response.Redirect(Request.RawUrl) 'includes paging info
        'End If 
    End Sub
#End Region

End Class
